package com.dom.domweb.modular.controller.sysmger;

import com.dom.domweb.common.RspModel;
import com.dom.domweb.dao.service.ITRolePrivRelService;
import com.dom.domweb.model.RolePrivsModel;
import com.dom.domweb.modular.shiro.model.ShiroUser;
import com.dom.domweb.modular.shiro.util.ShiroUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 角色权限控制层逻辑
 * @Author xllei
 * @Date 2018/12/7 2:10 PM
 * @Version 1.0
 **/
@RestController
@RequestMapping("/sys")
public class RolePrivController {
    @Autowired
    private ITRolePrivRelService rolePrivRelService;

    @RequestMapping(value = "/resetRolePriveleges", method = RequestMethod.POST)
    public RspModel resetRolePrivileges(@RequestBody RolePrivsModel rolePrivsModel){
        ShiroUser user = ShiroUtil.getUser();

        boolean result = rolePrivRelService.resetPrivileges(user, rolePrivsModel);
        return new RspModel(result);
    }
}
